﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AddEditCat.ascx.cs" Inherits="Admin_Product_AddEditCat" %>
<h2>
    Quản lý danh mục
</h2>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="error" />
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator" Display="None"></asp:CustomValidator>
<table width="100%">
    <tr>
        <td width="100px">
            Danh mục cha
        </td>
        <td>
            <asp:DropDownList ID="ddlCat" runat="server" AppendDataBoundItems="true" Width="150px">
                <asp:ListItem Value="">Chọn danh mục</asp:ListItem>
            </asp:DropDownList>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlCat"
                Display="Dynamic" ErrorMessage="Chọn danh mục">*</asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td>
            Tên danh mục
        </td>
        <td>
            <asp:TextBox ID="txtCatName" runat="server" Width="150px"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtCatName"
                Display="Dynamic" ErrorMessage="Nhập tên danh mục">*</asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td>
        </td>
        <td>
            <asp:Button ID="btnUpdate" runat="server" Text="Thêm" OnClick="btnUpdate_Click" />
            <asp:Button ID="btnCancel" runat="server" Text="Hủy cập nhật" Visible="false" ValidationGroup="cancel"
                OnClick="btnCancel_Click" />
            <asp:HiddenField ID="hidId" runat="server" />
        </td>
    </tr>
</table>
<table class="table">
    <tr>
        <th width="40px">
            STT
        </th>
        <th>
            Danh mục
        </th>
        <th width="150px">
            Danh mục cha
        </th>
        <th width="50px">
        </th>
    </tr>
    <asp:Repeater ID="rep" runat="server" OnItemCommand="rep_ItemCommand">
        <ItemTemplate>
            <tr>
                <td align="center">
                    <%# Container.ItemIndex +1 %>
                </td>
                <td>
                    <asp:LinkButton ID="edit" runat="server" CommandName="edit" CommandArgument='<%# Eval("Id") %>' ValidationGroup="edit"><%# Eval("CatName") %></asp:LinkButton>
                </td>
                <td>
                    <%# Eval("Parent") %>
                </td>
                <td align="center">
                    <asp:LinkButton ID="del" runat="server" CommandName="del" CommandArgument='<%# Eval("Id") %>'
                        OnClientClick="return confirm('Bạn xác nhận xóa dữ liệu?')" ValidationGroup="del"><img src="../images/delete.png" /></asp:LinkButton>
                </td>
            </tr>
        </ItemTemplate>
    </asp:Repeater>
</table>
